package com.atguigu.spzx.feign.product;

import com.atguigu.spzx.feign.product.fallback.ProductFeignClientFallback;
import com.atguigu.spzx.model.entity.order.OrderItem;
import com.atguigu.spzx.model.entity.product.ProductSku;
import com.atguigu.spzx.model.vo.common.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author syh
 * @create 2023-09-02 11:04
 */
@FeignClient(value = "service-product", fallback = ProductFeignClientFallback.class)
public interface ProductFeignClient {

//    @GetMapping("/api/product/getBySkuId/{skuId}")
//    public abstract Result<ProductSku> getBySkuId(@PathVariable Long skuId) ;

    @GetMapping("/api/product/sku/{skuId}")
    public Result<ProductSku> findSkuBySkuId(@PathVariable("skuId")Long skuId);

    @Operation(summary = "查询订单详情对应的商品列表，同时验库存减库存")
    @PostMapping("/api/product/findProductSkus")
    public Result<List<ProductSku>> findProductSkus(@RequestBody List<OrderItem> orderItemList);
}
